package com.dc.kylin.rabbitmq.component;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/***
 * 消费者
 */
@Component
public class ConcumerReceiver {

    //helloworld
    @RabbitListener(queues = "helloworldqueue")
    public void helloworldReceiver(String message) {
        System.out.println("接收到的消息："+message);
    };


    //pub\sub模式
    @RabbitListener(queues = "fanout.Q1")
    public void fanoutQ1Receive(String message) {
        System.out.println("发布订阅模式-fanout.Q1接收到的数据：" +message );
    }

    @RabbitListener(queues = "fanout.Q2")
    public void fanoutQ2Receive(String message) {
        System.out.println("发布订阅模式-fanout.Q2接收到的数据：" +message );
    }


    //work工作队列
    @RabbitListener(queues = "work_queue")
    public void workQueueReceiver01(String message) {
        System.out.println("工作队列模式-workQueueReceiver01接收到的数据：" +message );
    }

    @RabbitListener(queues = "work_queue")
    public void workQueueReceiver02(String message) {
        System.out.println("工作队列模式-workQueueReceiver02接收到的数据：" +message );
    }

    //direct
    @RabbitListener(queues = "directQueue01")
    public void directQueue01(String message) {
        System.out.println("Direct路由模式-directQueue01接收到的数据：" +message );
    }

    @RabbitListener(queues = "directQueue02")
    public void directQueue02(String message) {
        System.out.println("Direct路由模式-directQueue02接收到的数据：" +message );
    }

    //topic
    @RabbitListener(queues = "topic01")
    public void topicQueue01(String message) {
        System.out.println("Topic模式-topicQueue01接收到的数据：" +message );
    }

    @RabbitListener(queues = "topic02")
    public void topicQueue02(String message) {
        System.out.println("Topic模式-topicQueue02接收到的数据：" +message );
    }
}
